<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import { menuProps } from './menu';
defineOptions({ name: 'WindowsMenu' });
const props = defineProps(menuProps);
const _icon = (name: string) => {
  return new URL('/src/assets/icons/' + name + '.png', import.meta.url).href;
};
</script>

<template>
  <transition enter-active-class="animate__animated animate__fadeInLeft animate__faster" leave-active-class="animate__animated animate__fadeOutLeft animate__faster">
    <div class="windows-menu" v-if="isShow">
      <div class="windows-menu-top">
        <div class="windows-menu-top-left">
          <slot name="menu" />
        </div>
        <div class="windows-menu-top-right">
          <div class="avatar">
            <el-avatar src="/src/assets/avatar.jpg" :size="70" fit="contain" />
          </div>
          <div class="user-main">
            <div>
              <el-icon :size="20"><User /></el-icon>
              <span>个人中心</span>
            </div>
            <div>
              <el-icon :size="20"><Setting /></el-icon>
              <span>设置</span>
            </div>
          </div>
        </div>
      </div>
      <div class="windows-menu-footer">
        <div class="windows-menu-footer-left">
          <el-input class="w-50 m-2" placeholder="搜索菜单模块" prefix-icon="search" />
        </div>
        <div class="windows-menu-footer-right">
          <el-icon :size="20"><SwitchButton /></el-icon>
          <span>注销</span>
        </div>
      </div>
    </div>
  </transition>
</template>

<style scoped lang="scss">
.windows-menu {
  font-size: 12px;
  color: #fff;
  position: fixed;
  left: 5px;
  bottom: 45px;
  background: rgba(50, 57, 81, 0.9);
  height: 450px;
  width: 400px;
  border-radius: 5px;
  // padding: 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  // border: 1px solid rgba(128, 128, 128, 1);
  box-shadow: 0px 0px 10px 0px rgb(128 128 128 / 80%);
  z-index: 999;
  user-select: none;
}
.windows-menu-top {
  flex: 1;
  display: flex;
  padding: 5px;
}
.windows-menu-top-left {
  flex: 1;
  margin-right: 15px;
  height: 390px;
  overflow: auto;
  display: block;
}
.windows-menu-top-right {
  width: 120px;
  position: relative;
}
.windows-menu-footer {
  height: 40px;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 5px 10px;
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
}
.windows-menu-footer-left {
  flex: 1;
  margin-right: 15px;
}
.windows-menu-footer-right {
  // width: 120px;
  display: flex;
  align-items: center;
}
.windows-menu-footer-right span {
  margin-left: 5px;
}
.avatar {
  position: absolute;
  transform: translate(-50%, 0%);
  left: 50%;
  top: -40px;
}
.user-main {
  display: flex;
  flex-direction: column;
  margin-top: 50px;
}
.user-main > div {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}
.user-main > div:last-child {
  margin-bottom: 0px;
}
.user-main > div span {
  margin-left: 5px;
}
</style>
